#!/bin/usr/python
#-*- encoding=UTF-8 -*-

"""
: Binary tree 
"""

# Definition for a binary tree node.
class TreeNode(object):
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None

class BTree(object):
    """docstring for BTree"""
    def __init__(self):
        self.root = None

    def is_Empty(self):
        if root is None:
            return True
        else:
            return False

    def maxDepth(self, root):
        if root is None:
        	return 0
        else:
        	return max(self.maxDepth(root,left),self.maxDepth(root.right))+1

    def invertTree(self, root):
        if root != None:
            tmp = root.left
            root.left = self.invertTree(root.right)
            root.right = self.invertTree(tmp)
            return root

    def sumOfLeftLeaves(self,root):
        ans = 0
        if root is not None:
            if root.left is not None and root.left.left is None and root.left.right is None:
                ans += root.left.val
            if root.left is not None:
                ans += self.sumOfLeftLeaves(root.left)
            if root.right is not None:
                ans += self.sumOfLeftLeaves(root.right)
        return ans
           


if __name__ == '__main__':

